import { AbstractIdEntity, IdEntity, ITreeEntity } from '@/types/base-type';

interface Permission extends AbstractIdEntity {
  resourceType?: string;
  name?: string;
  code?: string;
  describe?: string;
}

interface Resource<T> extends AbstractIdEntity, ITreeEntity<string, T> {
  name?: string;
  code?: string;
  type?: string;
  describe?: string;
  permissions?: Permission[];
}

interface Tenant extends IdEntity<string> {
  name?: string;
  code?: string;
}

interface User extends AbstractIdEntity {
  username?: string;
  password?: string;
  name?: string;
  gender?: string;
  birthday?: string;
  identityCard?: string;
  phone?: string;
  mobile?: string;
  email?: string;
  accountExpiredTime?: string;
  accountNonLocked?: boolean;
  passwordErrorTimes?: number;
  passwordModifyTime?: string;
  enabled?: boolean;
  roles?: Role[];
  userIdentities?: Role[];
}

interface Role extends AbstractIdEntity, ITreeEntity<string, Role> {
  name?: string;
  code?: string;
  describe?: string;
  identityName?: string;
}

interface Dept extends AbstractIdEntity, ITreeEntity<string, Dept> {
  name?: string;
  code?: string;
}

interface Menu extends Resource<Menu> {
  url?: string;
  icon?: string;
  order?: number;
  externalLink?: boolean;
}

export {
  Permission, Resource,
  Tenant, User, Role, Dept, Menu,
};